+---------------------------------+
| The Megaman 3 - 6 Level Formats |
+---------------------------------+
version 3.1
by Matrixz 2002
matrixz15@yahoo.co.uk
http://matrixz.freeservers.com

Palettes
--------
Each level has it's own bg Palette and Palette Effects.
Palette Functions makes one of the four palettes to rotare
to make a effect. Palettes can be switched during the level.

Pattern Table
-------------
Each level has it's CHR. But this is not a part
of the level itself. It's either in CHR-ROM or somewhere else in the
PRG-ROM. CHR can be switched during the level.

Screen
------
Okay. Let's start. The level is built of screens. On each Screen Position, 1 of 32
Screen Presets can be used.  In the level data, there is data on wich screen to use for
each screen position. This utilizes that a Screen Preset can be re-used, in a totally
different part of the level and with totally different sprites. This is called Screen Order.

Well, the data in a Screen Preset has wich Structures to use in the Screen preset.
These are 4x4 tiles in size, wich means there are 8x8 of them in a Screen Preset.
The structure can be 1 of 256. (Wich again means a Screen Preset is 64 bytes in size)
Blah blah blah. I think you got it.

Again, each structure has it's data. This is wich 4 TSA Blocks to use in the Structure.
TSA Blocks are 2x2 tiles in size. The blocks can be 1 of 256.

Then finnaly, we have come to the inner of this system. There are two different kinds of
TSA Block data. The first, are wich type this block are (BG, Wall, FG, Spikes, .. and many more), and wich palette the block uses (0-3). Those two data's are 4-bit, so they are
kept in one byte. (Each block has 1 byte with both Palette and Type data). The TSA block-type data is different from each game. The other kind of TSA Block data is wich
4 tiles from the Pattern Table the block is made up of.

Sprites
-------
Each sprite has 4 bytes of data. The first is wich Screen Position to make the
sprite appear in, the two next is the X and Y positions of the sprite, and the last is
the Sprite Type. Note that sprites must come in correct screen order (Sprite 1 can't be
on Screen Position 0 if Sprite 0 is on Screen Position 1, etc.) The different games has
different methods to decide wich CHR banks and Palettes to use when different sprites is
showed. Megaman 3 for example, has this data in the Map Data. Megaman 4 has only wich
Bg Palette to use in the map data, Megaman 5 has wich sprite palette to use in the Map
Data, but the CHR's is loaded automatically depending on wich
Sprite Types that is showed up. Cool!

Scroll Data
-----------
This decides how the direction scrool goes. Each input has a byte, where the 4 first
bits tells how many screens the direction type is used on, and the next 4 bits tells
the direction type. There are also other bytes for each input, wich bg CHR, bg Palette,
sprite CHR banks and sprite Palette to use, but how many of these
that is used, is game-dependent.

Screen Usage
------------
Screen Usage means Wich Screen Preset to use for each Screen Position

Tiles used in Each block / TSA (Tile Sqaroid Assembler)
-------------------------------------------------------
This data is quite strange. There ain't 4 & 4 bytes for each Block
telling wich Tile to use. No. The $100 (256) first bytes in this data
tells wich Tile that is used as the first tile in every 256 block (the
upper left tile). The next $100 bytes tells wich second Tile that is
used in every 256 block etc..

So, the offset to find the tile used in a block is:
([[TSA Block] data section offset] + TSA block + (blocktile * $100))

Type/Palette for each TSA block
-------------------------------
If the data's Type/Palette, the first 4 bits in each byte tells
the Block Type, and the 4 last bits tells the Block Palette.

The data may also be Palette/Type, depending on the game,
and then these 4 and 4 bits meanings are switched.

Scroll Data: Sprite CHR Bank / Bg Palette for each Input
--------------------------------------------------------
Each input has two-byte sections of this data, the first byte
tells the Sprite CHR Bank and the second the Bg Palette.

MegaMan 3
---------
CHR-ROM = Yes
Levels = 20
Level Size = $2000
Level CHR Size = ($800 * 2)
Level Offset = ($10 + ([level] * $2000))
CHR Offset 0 = ($50010 + ([cpoint0] * $400))
CHR Offset 1 = ($50010 + ([cpoint1] * $400))
Sprites = $100 (256)

$A00 ($40): Screen Usage
$A40 ($10): Scroll Data: Direction Type/Lenght for each Position
$A60 ($20): Scroll Data: Sprite CHR Set & Palette / Bg Palette for each Position
$A80 ($1): [cpoint0]
$A81 ($1): [cpoint1]
$A82 ($50?): Palettes	
$AF0 ($1): Mid-Point Scroll Position to start at
$AF1 ($1): Boss Screen Path Scroll Position to start at
$AF8 ($1): Mid-Point Screen Position to start at
$AF9 ($1): Boss Screen Path Screen Position to start at
$B00 ($100): Sprite Data: Screen Position for each Enemy
$C00 ($100): Sprite Data: X Position for each Enemy
$D00 ($100): Sprite Data: Y Position for each Enemy
$E00 ($100): Sprite Data: Type for each Enemy
$F00 ($800): Structures used in each Screen Preset
$1700 ($400): Blocks used in each Structure
$1B00 ($400): Tiles used in each Block (TSA Block Data)
$1F00 ($100): Type/Palette for each Block (TSA Block)
	
Other Data:
$2040 ($200): Sprite Palettes
$2210 ($200): SPR-Chr Banks to use for each Sprite CHR Set
$3CD1C ($12): Music Track for each level

MegaMan 4
---------
CHR-ROM = No
Levels = 21
Level Size = $2000
Level CHR Size = $1000
Level Offset = ($40010 + ([level] * $2000))
CHR Offset = ($20010 + ([level] * $1000))
Sprites = $80 (128)

$0 ($400): Tiles used in each Block (TSA Block Data)
$400 ($100): Type/Palette for each Block (TSA Block Data)
$500 ($400): Blocks used in each Structure
$900 ($800): Structures used in each Screen Preset
$1100 ($80): Sprite Data: Screen Position for each Enemy
$1180 ($80): Sprite Data: X Position for each Enemy
$1200 ($80): Sprite Data: Y Position for each Enemy
$1280 ($80): Sprite Data: Type for each Enemy
$1300 ($80): Check order for each Enemy?
$1500 ($20): Screen Usage
$1530 ($20): Scroll Data: Direction Type/Lenght for each Position
$1550 ($20): Scroll Data: Bg Palette for each Position
$1560 ($20): Scroll Data: Special Effect for each Position
$1590 ($50?): Palettes

Multidir Data:
$1540: Screen Usage Position with path to Second Path
$1541: Scroll to Second Path Direction Type/Lenght
$1542: Scroll Position Start (Second Path)
$1543: Screen Usage Position Start (Second Path)
$1544: Screen Usage Position with return path to Main Path
$1546: Return Scroll Position Start
$1547: Return Screen Usage Position Start

Other Data:
$7C86B ($10): Music Track for each level
$518F0: Start setup for each level
  $0 ($8): Start Sprite Palette
  $8: BG CHR Bank Page (Offset = * $2000)
  $9: BG CHR Load Size (* $100)
  $A: PRG-ROM Offset to read BG CHR from (* $100)
  $B: VRAM Offset to write to (* $100)
  $C: SPR CHR Bank Page (Offset = * $2000)
  $D: SPR CHR Load Size (* $100)
  $E: PRG-ROM Offset to read SPR CHR from (* $100)
  $F: VRAM Offset to write to (* $100)
  $10: "Ready" text tiles CHR Bank (Offset = * $2000) 
  $12: Offset for "Ready" text tiles (* $100)

MegaMan 5
---------
CHR-ROM = Yes
Levels = 18
Level Size = $2000
level CHR Size = ($800 * 2)+
Level Offset = ($10 + ([level] * $2000))
CHR Offset 0 = ($40010 + ([cpoint0] * $400))
CHR Offset 1 = ($40010 + ([cpoint1] * $400))
Sprites = $80 (128)

$900 ($50): Screen Usage
$950 ($18): Scroll Data: Direction Type/Lenght for each Position
$968 ($20): Scroll Data: Sprite Palette Preset for each Position
$980 ($1): [cpoint0]
$981 ($1): [cpoint1]
$988 (?): Palettes
$A00 ($80): Sprite Data: Screen Position for each Enemy
$A80 ($80): Sprite Data: X Position for each Enemy
$B00 ($80): Sprite Data: Y Position for each Enemy
$B80 ($80): Sprite Data: Type for each Enemy
$D00 ($400): Tiles used in each Block (TSA Block Data)
$1100 ($100): Type/Palette for each Block (TSA Block Data)
$1200 ($100): Blocks used in each Structure
$1600 ($100): Structures used in each Screen Preset

Other Data:
$AE: ($200): Sprite Palette Presets
$3D4E2 ($10): Music Track for each level

MegaMan 6
---------
CHR-ROM = No
Levels = ?
Level Size = ?
Level CHR Size $1000+

Datatypeoffsets:

$58000: TSA/BlockType-Pal/Blocks>Structures for each Levelbank-level
  Levelbank Offset = (Levelbank * $2000)
  $0: Levelbank-Level 0 Data
  $900: Levelbank-Level 1 Data
    $0 ($400): Tiles used in each Block (TSA Block Data)
    $400 ($100): Type/Palette for each Block (TSA Block Data)
    $500 ($400): Blocks used in each Structure

$64000: Structures used in each Screen
  Level Offset = (Level * $800)